package com.itbaizhan.utils;

/**
 * @author spf
 * @date 2024/3/6
 * @time 14:54
 */

import java.util.Random;

/**
 * 生成验证码类
 */
public class RandomUtil {

    public static String buildCheckCode(int digit){
        String str = "0123456789";
        StringBuilder builder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < digit; i++) {
            char ch = str.charAt(random.nextInt(str.length()));
            builder.append(ch);
        }
        return builder.toString();
    }
}
